<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.db.conn"%>
<%@ page import="java.sql.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
<jsp:include flush="true" page="${basePath}/admin/head.jsp"></jsp:include>
<link rel="stylesheet" href="<%=path %>/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="<%=path %>/kindeditor/plugins/code/prettify.css" />
<script charset="utf-8" src="<%=path %>/kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="<%=path %>/kindeditor/lang/zh_CN.js"></script>
<script charset="utf-8" src="<%=path %>/kindeditor/plugins/code/prettify.js"></script>
<script>
    KindEditor.ready(function(K) {
        var editor1 = K.create('textarea[name="Textarea1"]', {
            cssPath : '<%=path %>/kindeditor/plugins/code/prettify.css',
            uploadJson : '<%=path %>/kindeditor/jsp/upload_json.jsp',
            fileManagerJson : '<%=path %>/kindeditor/jsp/file_manager_json.jsp',
            allowFileManager : true,
            afterCreate : function() {
                var self = this;
                K.ctrl(document, 13, function() {
                    self.sync();
                    document.forms['example'].submit();
                });
                K.ctrl(self.edit.doc, 13, function() {
                    self.sync();
                    document.forms['example'].submit();
                });
            }
        });
        prettyPrint();
    });
</script>



			<script type="text/javascript" src="<%=path%>/admin/js/popup_shuaxin_no.js"></script>
	<script language="javascript">     
		    
	       function up2()
	       {
		        var pop=new Popup({ contentType:1,isReloadOnClose:false,width:400,height:200});
	            pop.setContent("contentUrl","<%=path%>/upfile/upload1.jsp");
	            pop.setContent("title","文件上传");
	            pop.build();
	            pop.show();
	       }
        </script>

 </head>

 
 <body>

 <div class="card">
        <ul class="nav nav-tabs page-tabs">
            <li class="active"><a>编辑商品信息</a></li>
        </ul>
        <div class="tab-content" style="min-height: 450px;">

		<form  action="<%=path %>/products_Edit" method="post">
            <table style="width: 100%;" >
                   <% 			conn cn=new conn();
    
     			String id = request.getParameter("id");
				String sql = "select * from products where pid=" + id ;
				ResultSet rs = cn.query(sql);
				rs.next();
			%>
<tr>
<td  style=" text-align:right; width:20%;"><font style='color:red'>*&nbsp;</font>商品分类:</td>
<td class="tbright"><div style="display:inline;float:left;">
<select name="se_tid" id="tidid" style='width:200px' >
<%
 conn cntid=new conn();
String tid = rs.getString("tid");
ResultSet rstid=cntid.query("select  tid,tname from ptype ");
while (rstid.next()) {

String idtid = rstid.getString("tid");
if (tid.equals(idtid)) {

	out.println("<option value=\"" + rstid.getString("tid") + "\" selected=\"selected\">"
												+ rstid.getString("tname") + "</option>");
} else {

	out.println("<option value=\"" + rstid.getString("tid") + "\" >"
												+ rstid.getString("tname") + "</option>");
}
}
if (rstid != null)
					rstid.close();
				if (cntid != null)
					cntid.close();
 %>
</select>
 </td></tr>

<tr>
<td  style=" text-align:right; width:20%;"><font style='color:red'>*&nbsp;</font>商品名称:</td>
<td class="tbright"><div style="display:inline;float:left;">
<input name="txt_ptitle" type="text" id="txt_ptitle" style="width: 200px; " required  value='<%= rs.getString("ptitle") %>' /></div>
</div> 
 </td></tr>

<tr>
<td  style=" text-align:right; width:20%;"><font style='color:red'>*&nbsp;</font>商品图片:</td>
<td class="tbright"><div style="display:inline;float:left;">
<img src='<%=path %>/<%= rs.getString("photo") %>' width=100 height=100><input type="text" name="fujian" id="fujian" size="50"  value='<%= rs.getString("photo") %>' readonly="readonly" />
<input type="button" value="上传" onclick="up2()" />
 </td></tr>

<tr>
<td  style=" text-align:right; width:20%;"><font style='color:red'>*&nbsp;</font>价格:</td>
<td class="tbright"><div style="display:inline;float:left;">
<input name="txt_price" type="text" id="txt_price" style="width: 200px; "  required   pattern="((^[-]?([1-9]\d*))|^0)(\.\d{1,2})?$|(^[-]0\.\d{1,2}$)"  value='<%= rs.getString("price") %>'  /></div>
 </td></tr>

<tr>
<td  style=" text-align:right; width:20%;">商品简介:</td>
<td class="tbright"><div style="display:inline;float:left;">
<textarea id="Textarea1"  name="Textarea1"  cols="100" rows="8" style="width:700px;height:400px;visibility:hidden;"><%= rs.getString("pememo") %></textarea></div>
 </td></tr>

<tr>
<td  style=" text-align:right; width:20%;"><font style='color:red'>*&nbsp;</font>商品状态:</td>
<td class="tbright"><div style="display:inline;float:left;">
<select name="se_pflag" id="pflagid" >
    <option value="上架"  <%=rs.getString("pflag").equals("上架")?"selected=\"selected\"":"" %>>上架</option>
    <option value="下架"  <%=rs.getString("pflag").equals("下架")?"selected=\"selected\"":"" %>>下架</option>

</select> </td></tr>



                <tr>
                    <td>&nbsp;</td>
                    <td align="left">
					    <input name="id" type="hidden" id="id" value='<%= request.getParameter("id") %>'> 
                         <input type="submit" name="btnAdd" value="编 辑"   id="btnAdd"     class="btn btn-primary" />
                     <input name="btnReturn" type="button" value="返 回"   class="btn btn-danger"  onclick="location.href='<%=path %>/admin/products/products_Manage.jsp';"  />
                    </td>
                </tr>
            </table>
				<%
                                 if (rs != null)
                                        rs.close();
                                  if (cn != null)
                                        	cn.close();
                          	%>
		 </form>
         

        </div>
    </div>


</body>
</html>


